#ifndef __BSP_SGM51513_I2C_2_H__
#define __BSP_SGM51513_I2C_2_H__

#include <stdint.h>



#define SGM415XX_SDA_GPIO_CLOCK    RCC_APB2_PERIPH_GPIOB
#define SGM415XX_SCL_GPIO_CLOCK    RCC_APB2_PERIPH_GPIOB
#define SGM415XX_nCE_CLOCK         RCC_APB2_PERIPH_GPIOB
#define SGM415XX_INT_CLOCK         RCC_APB2_PERIPH_GPIOB

#define SGM415XX_SDA_GPIO_PORT    GPIOB
#define SGM415XX_SCL_GPIO_PORT    GPIOB
#define SGM415XX_nCE_GPIO_PORT    GPIOB
#define SGM415XX_INT_GPIO_PORT    GPIOB

#define SGM415XX_SDA_GPIO_PIN     GPIO_PIN_7
#define SGM415XX_SCL_GPIO_PIN     GPIO_PIN_6
#define SGM415XX_nCE_GPIO_PIN     GPIO_PIN_3
#define SGM415XX_INT_GPIO_PIN     GPIO_PIN_5



#define SGM415XX_nCE_Set(en)    do { \
                                    if (en)  \
                                        GPIO_ResetBits(SGM415XX_nCE_GPIO_PORT, SGM415XX_nCE_GPIO_PIN); \
                                    else     \
                                        GPIO_SetBits(SGM415XX_nCE_GPIO_PORT, SGM415XX_nCE_GPIO_PIN);  \
                                } while (0)


void bsp_InitI2c_SGM415x_2(void);

int com_i2cm_sgm415x_8bitread_2(uint8_t slav_addr, uint8_t read_cmmd, uint8_t numb, uint8_t *blck_data);
int com_i2cm_sgm415x_8bitwrit_2(uint8_t slav_addr, uint8_t writ_cmmd, uint8_t numb, uint8_t *blck_data);

#endif
